package com.chixing.ih.module.system.mapper;

import com.chixing.ih.module.system.mapper.provider.AdminMapperProvider;
import com.chixing.ih.module.system.pojo.Admin;
import org.apache.ibatis.annotations.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘岩
 * Date: 2020-09-26
 * Time: 13:14
 *
 * @version 1.0
 */
@Mapper
public interface AdminMapper {



    /**
     * 根据账户判断管理员是否存在以及密码是否正确
     *
     * @param adminAccount
     * @return
     */


    @SelectProvider(type = AdminMapperProvider.class, method = "getOneByAccount")
    @Results(id = "adminMap", value = {
            @Result(id = true, column = "admin_id", property = "adminId"),
            @Result(column = "admin_account", property = "adminAccount"),
            @Result(column = "nick_name", property = "nickName"),
            @Result(column = "admin_password", property = "adminPassword"),
            @Result(column = "admin_telephone", property = "adminTelephone"),
            @Result(column = "role_id", property = "roleId"),
            @Result(column = "admin_email", property = "adminEmail"),
            @Result(column = "create_time", property = "createTime"),
            @Result(column = "update_time", property = "updateTime"),
            @Result(column = "is_deleted", property = "isDeleted")

    })
    Admin getAdminByAccount(String adminAccount);

    /**
     * 根据管理员昵称判断昵称是否重复
     *
     * @param adminNickName
     * @return
     */
    @SelectProvider(type = AdminMapperProvider.class, method = "getOneByNickName")
    @ResultMap("adminMap")
    Admin getAdminByNickName(String adminNickName);


    /**
     * 判断管理员账号密码是否正确
     *
     * @param admin
     * @return
     */

    @SelectProvider(type = AdminMapperProvider.class, method = "getOne")
    @ResultMap("adminMap")
    Admin getAdmin(Admin admin);


}
